<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>table模块快速使用</title>
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
    <script src="../layui/layui.js"></script>
    <script src="../Login/js/jquery-3.5.1.min.js"></script>
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
    <style type="text/css">
        body {
            width: 100%;
            height: 100%;
        }

        #tab {
            width: 100%;
            padding: 0;
        }

        th {
            height: 100px;
        }

        td {
            height: 100px;
        }
    </style>
</head>


<body>
<table class="layui-table" id="tab">
    <tr>
        <th id="day1">星期一</th>
        <th id="day2">星期二</th>
        <th id="day3">星期三</th>
        <th id="day4">星期四</th>
        <th id="day5">星期五</th>
    </tr>
    <tr>
        <td id="_11"></td>
        <td id="_21"></td>
        <td id="_31"></td>
        <td id="_41"></td>
        <td id="_51"></td>
    </tr>
    <tr>
        <td id="_12"></td>
        <td id="_22"></td>
        <td id="_32"></td>
        <td id="_42"></td>
        <td id="_52"></td>
    </tr>
    <tr>
        <td id="_13"></td>
        <td id="_23"></td>
        <td id="_33"></td>
        <td id="_43"></td>
        <td id="_53"></td>
    </tr>
    <tr>
        <td id="_14"></td>
        <td id="_24"></td>
        <td id="_34"></td>
        <td id="_44"></td>
        <td id="_54"></td>
    </tr>
</table>
</body>
<script type="text/javascript">
    function Myfunction() {
        $.ajax({
            type:'get',
            url:'usss.json',
            dataType:'json',
            success: function (data) {
                console.log(data);
                console.log(data.data.length);
                var length=data.data.length;
                for (var i=0;i<length;i++) {
                    var week=data.data[i].week;
                    console.log(week);
                    var time=data.data[i].time;
                    var kname=data.data[i].kname;
                    var teacher=data.data[i].teacher;
                    var kaddress=data.data[i].kaddress
                    for (var s = 1; s < 8; s++) {
                        for (var j = 1; j < 5; j++) {
                            if (week == s && time == j) {
                                var str = "_" + s.toString() + j.toString();
                                document.getElementById(str).innerHTML = kname + "</tr>" + teacher + "</tr>" +kaddress;
                            }
                        }
                    }
                }
            }, error: function (e) {
                console.log(e.status);
            }
        })
    }
    Myfunction();
</script>
</html>